<?php 
echo $this->Html->script('comment', array('inline' => false));
$script = " var replyUrlGet = '". $this->Html->url(array('controller' => 'Comments', 'action' => 'itemAjax')). "' ;";
$script .= " var postCommentUrl = '". $this->Html->url(array('controller' => 'Comments', 'action' => 'add')). "' ;";
$script .= " var postReplyUrl = '". $this->Html->url(array('controller' => 'Comments', 'action' => 'addReply')). "' ;";
$script .= " var deleteReplyUrl = '". $this->Html->url(array('controller' => 'Comments', 'action' => 'deleteReply')). "' ;";
$script .= " var deleteCommentUrl = '". $this->Html->url(array('controller' => 'Comments', 'action' => 'delete')). "' ;";
$script .= " var blankErrorMessage = '". Messages::you_must_enter_the_content_of_comment . "' ;";
echo $this->Html->scriptBlock($script, array('inline' => false));
if(!isset($showPostForm) || $showPostForm == true){
	list($comments, $showPostForm, $userId, $showAll) = $this->requestAction('/Comments/listOfElement/' . $courseId); 
}
?>
<h2 class="title">タイムライン</h2>
<div class="postedSection">
	<?php if($showPostForm == true): ?>
	<div class="posted new">
		<div class="content">
			<p id="errorMessageDisplay" class="attention"></p>
			<?php if($userLogon): ?>
			<p class="information">こちらから講師への質問をすることができます</p>
			<textarea name="" id="txtPostComment" placeholder="初心者なのですが、問題なくついていけますか？"></textarea>
			<div class="submit">
				<input id="postComment" type="button" class="postSubmit" value="投稿する" />
			</div>
			<?php else: ?>
			<h3><?php echo $this->Html->link(Messages::to_comment_course_please_signin, array('controller' => 'Users', 'action' => 'signin')); ?></h3>
			<?php endif; ?>
		</div>
	</div>
	<?php endif; ?>
	<input type="hidden" value="<?php echo $courseId; ?>" id="courseIdHidden"/>
	<div id="commentList" >
		<?php echo $this->element('comment/list_comment_ajax', array(
			'comments' => $comments,
			'userId' => $userId,
			'showPostForm' => $showPostForm,
			'showAll' => $showAll
		)); ?>
	</div>
	<?php if($showPostForm == true): ?>
	<div class="buttonMore">
		<?php echo $this->Html->link('タイムラインをもっと見る', array('controller' => 'Comments', 'action' => 'index', $courseId)); ?>
	</div>
	<?php endif; ?>
</div>